//
//  DetailMainViewController.m
//  Item A House
//
//  Created by dlios on 15/5/26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "DetailMainViewController.h"

@interface DetailMainViewController ()

@end

@implementation DetailMainViewController
- (void)dealloc
{
    [_detail release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.detail = [NSMutableDictionary dictionary];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, self.view.frame.size.width, 20)];
    title.text = [self.detail objectForKey:@"title"];
    title.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
    [self.view addSubview:title];
    [title release];
    
    UILabel *summary = [[UILabel alloc] initWithFrame:CGRectZero];
    //自适应
    summary.text = [self.detail objectForKey:@"summary"];
    summary.numberOfLines = 0;
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:17]};
    CGRect rect = [summary.text boundingRectWithSize:CGSizeMake(200, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    [summary setFrame:CGRectMake(10, 10, self.view.frame.size.width - 20, rect.size.height)];
    [self.view addSubview:summary];
    [summary release];
    
    UILabel *data = [[UILabel alloc] initWithFrame:CGRectMake(10, rect.size.height, self.view.frame.size.width, 20)];
    data.text = [self.detail objectForKey:@"article_time_date"];
    data.font = [UIFont systemFontOfSize:17];
    [self.view addSubview:data];
    [data release];
}



@end
